/**
 * Copyright 2022-2023 SpriteLab @ Northeastern University
 *
 * This file is part of 5GSniffer.
 *
 * 5GSniffer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * 5GSniffer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * A copy of the GNU Affero General Public License can be found in
 * the LICENSE file in the top-level directory of this distribution
 * and at http://www.gnu.org/licenses/.
 *
 */

#include "gtest/gtest.h"
#include "pss.h"
#include "fftw3.h"
// #include "mat.h"

class pss_test : public ::testing::Test {
 protected:
  pss_test() {
  }

};

TEST_F(pss_test, test_pss_set) {

pss pss1;
int n_id_2 = pss1.get_nid_2();

EXPECT_EQ(n_id_2, 0);

// pss1.set_nid_2(-1);

// EXPECT_EQ(pss1.get_nid_2(), 0);

// pss1.set_nid_2(4);

// EXPECT_EQ(pss1.get_nid_2(), 0);

pss1.set_nid_2(2);

EXPECT_EQ(pss1.get_nid_2(), 2);

}

TEST_F(pss_test, test_pss_frequency) {

  pss pss1;

  std::array <std::complex<float>,pss::pss_length>  pss_seq_0 = pss1.generate_pss_seq(0);

  std::array <std::complex<float>,pss::pss_length>  pss_seq_1 = pss1.generate_pss_seq(1);

  std::array <std::complex<float>,pss::pss_length>  pss_seq_2 = pss1.generate_pss_seq(2);

  std::array <std::complex<float>,pss::pss_length> pss_seq_ref_0 = {1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,-1};
  
  std::array <std::complex<float>,pss::pss_length> pss_seq_ref_1 = {1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1};
  
  std::array <std::complex<float>,pss::pss_length> pss_seq_ref_2 = {-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1};


  for (int i = 0; i < pss_seq_0.size(); ++i) {
    EXPECT_FLOAT_EQ((pss_seq_0.at(i)).real(), (pss_seq_ref_0.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((pss_seq_0.at(i)).imag(), (pss_seq_ref_0.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < pss_seq_1.size(); ++i) {
    EXPECT_FLOAT_EQ((pss_seq_1.at(i)).real(), (pss_seq_ref_1.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((pss_seq_1.at(i)).imag(), (pss_seq_ref_1.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < pss_seq_2.size(); ++i) {
    EXPECT_FLOAT_EQ((pss_seq_2.at(i)).real(), (pss_seq_ref_2.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((pss_seq_2.at(i)).imag(), (pss_seq_ref_2.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }


}

TEST_F(pss_test, test_pss_time) {

  pss pss1;

  std::array <std::complex<float>,pss::pss_length>  pss_seq_0 = pss1.generate_pss_seq(0);

  std::array <std::complex<float>,pss::pss_length>  pss_seq_1 = pss1.generate_pss_seq(1);

  std::array <std::complex<float>,pss::pss_length>  pss_seq_2 = pss1.generate_pss_seq(2);

  
  std::array <std::complex<float>,ssb_nfft> pss_seq_t_0 = pss1.convert_pss_t(pss_seq_0);

  std::array <std::complex<float>,ssb_nfft> pss_seq_t_1 = pss1.convert_pss_t(pss_seq_1);

  std::array <std::complex<float>,ssb_nfft> pss_seq_t_2 = pss1.convert_pss_t(pss_seq_2);

  std::array <std::complex<float>,ssb_nfft> pss_seq_ref_t_0 = {-1.00000000000000 + 0.00000000000000i,2.02558352996864 - 1.56424877948230i,7.11664163067063 - 8.61844855236065i,8.20746854172450 - 13.9971597069576i,5.86815146579919 - 9.95129793803779i,5.68326173247147 - 3.65121225383105i,8.92969744261807 - 6.39487978176359i,9.76348813238836 - 13.5671423637555i,3.31958637956890 - 11.5144145604235i,-6.70981085159678 - 1.52707352549082i,-11.3553311255104 + 0.997346022709846i,-6.12415677158348 - 7.16890182755759i,4.36381885790567 - 10.4402266081634i,11.1033309914266 - 0.745632768202043i,9.14910082029709 + 7.47904209133319i,1.73236532085041 + 0.740971288923854i,-3.63872960283282 - 10.0782015624102i,-3.34724081185858 - 6.21488746752687i,-1.13226666067816 + 9.29899778497225i,-2.44934827940739 + 16.8861867279957i,-7.16412340595267 + 9.83525725510715i,-10.6288355284770 - 0.0499835821814396i,-10.5758365558144 - 4.26781618034310i,-8.64270554215701 - 6.81501804896653i,-5.37297607698243 - 10.1133299672529i,1.04161159653810 - 8.99707803688757i,9.57176395311536 - 3.21376996310209i,14.6627879457409 - 0.778433484606541i,12.2282267385866 - 3.20007138832974i,3.99633292353357 - 1.44455670821010i,-5.49478522154995 + 6.77657313581141i,-12.3007803739160 + 9.95548880621288i,-12.6066017177982 + 2.12132034355964i,-4.47869507621121 - 4.37979537035737i,7.43633818499241 + 2.06012819027932i,14.1478762222519 + 11.6936067209483i,12.2054437587054 + 7.50289599306383i,6.96430558837228 - 7.15354087760464i,4.27231406138905 - 12.4428809757101i,4.51761913323122 - 1.98210359719058i,6.44566321350236 + 8.19746814135188i,9.57784103253549 + 4.48548059583750i,10.4761665009709 - 4.96058146796508i,4.98755732881285 - 4.23297325331709i,-2.72738926062222 + 6.84898661728365i,-3.05885200311417 + 14.5792733840486i,3.28271853333215 + 12.2863558584987i,3.85135975284877 + 7.42129688208745i,-5.50721115130182 + 6.60685419694907i,-12.4518470885752 + 4.60906998875368i,-8.44267434995982 - 5.00011965539262i,-2.84407898939727 - 15.5274117636921i,-4.69478695319596 - 14.1619903864122i,-5.27184666660217 - 1.46346659303286i,4.31837557781476 + 7.29974248108759i,11.5898975675211 + 2.87697237816168i,0.576021479392856 - 6.00425613830549i,-17.8947114399093 - 6.96023265498315i,-18.5284134838684 - 1.23758826643414i,-0.292492452226088 + 1.79948372352903i,12.1840694578413 + 0.735970094230532i,6.45376312037222 + 2.18144735193755i,-2.78856100591117 + 8.02366912023641i,-1.07335431797422 + 12.4889476784899i,6.00000000000000 + 11.0000000000000i,8.15449952398854 + 4.24969890550508i,6.41452849745064 - 5.18115506013030i,4.32446407089909 - 13.2261602151734i,-0.840372112187851 - 13.7523046749739i,-8.88387534973292 - 5.46237684219512i,-12.2362763005720 + 2.81073210007806i,-8.71249448824609 + 1.81626554282104i,-6.46591606305976 - 5.36431924185585i,-9.75032295140657 - 8.49407933434317i,-12.1752753199026 - 4.98490682201433i,-9.73812158508971 + 0.0180211890830881i,-7.36796527990047 + 4.92824994361506i,-7.08537955113193 + 11.3395595576996i,-3.76471610842269 + 14.4633288596562i,1.64336737667773 + 7.26935158194068i,-0.149643098190562 - 5.39314580305093i,-9.33169198226154 - 9.70970832349642i,-13.3127990678197 - 1.92954856632051i,-7.99034443942197 + 7.14950613949475i,-5.63008046998733 + 8.55734851763694i,-12.2654797916697 + 4.37440302473756i,-15.2805722448123 - 1.22603421571935i,-5.83496940674020 - 7.70882927990730i,3.77380017133413 - 12.0676024002205i,0.222626676276989 - 9.41309707706915i,-9.01588727320339 - 3.32600050612093i,-10.5083701854238 - 3.39781890834116i,-7.20728377348613 - 8.67469271936294i,-7.96110620546904 - 6.84162390164449i,-7.87486298714269 + 4.78411105681542i,0.694435370733648 + 11.3972676555851i,8.60660171779821 + 2.12132034355964i,3.34035602138443 - 12.8338248561052i,-6.51125184045658 - 16.4649093950576i,-3.35304020933449 - 7.22923947490276i,8.46249773308436 + 2.79544867951437i,8.44723870788653 + 5.04855676262190i,-4.98190849807518 + 1.02867943137327i,-10.6190894215490 - 3.15847686101143i,0.810366941638324 - 2.09412926136344i,11.7148660357578 + 4.78969526184461i,5.81951972352688 + 10.6267218141132i,-8.55026671164935 + 8.40838249034696i,-14.4968601214976 + 2.35921677869828i,-10.0771329450525 + 3.09700333274613i,-3.48940970325470 + 9.95223999498101i,2.74571308988567 + 10.5616839223324i,9.29558385232520 + 1.92179843758976i,10.5366022288773 - 2.90988645945281i,1.71004653650579 + 3.18422024324044i,-8.82659449113825 + 7.78907630117003i,-7.53744736268847 - 0.534388654898250i,4.82739286691052 - 11.1818533543223i,12.7729534437272 - 6.75472953615100i,7.04071351880692 + 9.30959900952301i,-3.08654604539438 + 17.4097935834881i,-3.30455959145099 + 10.0702494288407i,5.98871009859653 - 0.593573492395652i,10.6909008722596 - 3.49637543823584i,2.35410072759619 - 2.26646392697137i,-10.5873587567409 - 4.68137331684454i,-14.2980472580533 - 9.16132113216296i,-7.74067256441843 - 8.15115830372091i,-3.00000000000000 + 0.00000000000000i,-7.74067256441843 + 8.15115830372092i,-14.2980472580533 + 9.16132113216296i,-10.5873587567409 + 4.68137331684454i,2.35410072759619 + 2.26646392697137i,10.6909008722596 + 3.49637543823584i,5.98871009859653 + 0.593573492395649i,-3.30455959145099 - 10.0702494288407i,-3.08654604539437 - 17.4097935834880i,7.04071351880692 - 9.30959900952301i,12.7729534437272 + 6.75472953615100i,4.82739286691052 + 11.1818533543223i,-7.53744736268846 + 0.534388654898251i,-8.82659449113825 - 7.78907630117003i,1.71004653650579 - 3.18422024324044i,10.5366022288773 + 2.90988645945281i,9.29558385232520 - 1.92179843758976i,2.74571308988567 - 10.5616839223324i,-3.48940970325470 - 9.95223999498101i,-10.0771329450525 - 3.09700333274613i,-14.4968601214976 - 2.35921677869828i,-8.55026671164935 - 8.40838249034696i,5.81951972352688 - 10.6267218141132i,11.7148660357578 - 4.78969526184461i,0.810366941638325 + 2.09412926136343i,-10.6190894215490 + 3.15847686101143i,-4.98190849807518 - 1.02867943137327i,8.44723870788653 - 5.04855676262190i,8.46249773308436 - 2.79544867951437i,-3.35304020933449 + 7.22923947490275i,-6.51125184045658 + 16.4649093950576i,3.34035602138443 + 12.8338248561052i,8.60660171779821 - 2.12132034355964i,0.694435370733646 - 11.3972676555851i,-7.87486298714270 - 4.78411105681542i,-7.96110620546904 + 6.84162390164448i,-7.20728377348613 + 8.67469271936294i,-10.5083701854238 + 3.39781890834116i,-9.01588727320339 + 3.32600050612093i,0.222626676276988 + 9.41309707706915i,3.77380017133413 + 12.0676024002205i,-5.83496940674020 + 7.70882927990730i,-15.2805722448123 + 1.22603421571935i,-12.2654797916697 - 4.37440302473756i,-5.63008046998733 - 8.55734851763694i,-7.99034443942197 - 7.14950613949475i,-13.3127990678197 + 1.92954856632052i,-9.33169198226154 + 9.70970832349642i,-0.149643098190562 + 5.39314580305093i,1.64336737667773 - 7.26935158194068i,-3.76471610842269 - 14.4633288596562i,-7.08537955113193 - 11.3395595576996i,-7.36796527990047 - 4.92824994361506i,-9.73812158508971 - 0.0180211890830879i,-12.1752753199026 + 4.98490682201433i,-9.75032295140656 + 8.49407933434317i,-6.46591606305976 + 5.36431924185585i,-8.71249448824609 - 1.81626554282104i,-12.2362763005720 - 2.81073210007806i,-8.88387534973292 + 5.46237684219512i,-0.840372112187852 + 13.7523046749739i,4.32446407089909 + 13.2261602151734i,6.41452849745064 + 5.18115506013030i,8.15449952398853 - 4.24969890550508i,6.00000000000000 - 11.0000000000000i,-1.07335431797422 - 12.4889476784899i,-2.78856100591117 - 8.02366912023641i,6.45376312037222 - 2.18144735193756i,12.1840694578413 - 0.735970094230531i,-0.292492452226085 - 1.79948372352903i,-18.5284134838684 + 1.23758826643414i,-17.8947114399093 + 6.96023265498315i,0.576021479392855 + 6.00425613830548i,11.5898975675211 - 2.87697237816168i,4.31837557781476 - 7.29974248108759i,-5.27184666660217 + 1.46346659303286i,-4.69478695319596 + 14.1619903864122i,-2.84407898939727 + 15.5274117636921i,-8.44267434995982 + 5.00011965539262i,-12.4518470885752 - 4.60906998875368i,-5.50721115130182 - 6.60685419694907i,3.85135975284877 - 7.42129688208745i,3.28271853333215 - 12.2863558584987i,-3.05885200311417 - 14.5792733840486i,-2.72738926062222 - 6.84898661728365i,4.98755732881285 + 4.23297325331709i,10.4761665009709 + 4.96058146796508i,9.57784103253549 - 4.48548059583750i,6.44566321350236 - 8.19746814135188i,4.51761913323122 + 1.98210359719058i,4.27231406138905 + 12.4428809757101i,6.96430558837228 + 7.15354087760464i,12.2054437587054 - 7.50289599306383i,14.1478762222519 - 11.6936067209483i,7.43633818499241 - 2.06012819027932i,-4.47869507621121 + 4.37979537035737i,-12.6066017177982 - 2.12132034355964i,-12.3007803739160 - 9.95548880621288i,-5.49478522154995 - 6.77657313581141i,3.99633292353357 + 1.44455670821009i,12.2282267385866 + 3.20007138832974i,14.6627879457409 + 0.778433484606540i,9.57176395311537 + 3.21376996310209i,1.04161159653809 + 8.99707803688757i,-5.37297607698243 + 10.1133299672530i,-8.64270554215701 + 6.81501804896653i,-10.5758365558144 + 4.26781618034310i,-10.6288355284770 + 0.0499835821814396i,-7.16412340595267 - 9.83525725510715i,-2.44934827940739 - 16.8861867279957i,-1.13226666067816 - 9.29899778497225i,-3.34724081185857 + 6.21488746752687i,-3.63872960283282 + 10.0782015624102i,1.73236532085042 - 0.740971288923854i,9.14910082029709 - 7.47904209133319i,11.1033309914266 + 0.745632768202041i,4.36381885790567 + 10.4402266081634i,-6.12415677158348 + 7.16890182755759i,-11.3553311255104 - 0.997346022709846i,-6.70981085159678 + 1.52707352549082i,3.31958637956890 + 11.5144145604235i,9.76348813238836 + 13.5671423637555i,8.92969744261807 + 6.39487978176359i,5.68326173247147 + 3.65121225383105i,5.86815146579919 + 9.95129793803778i,8.20746854172451 + 13.9971597069576i,7.11664163067063 + 8.61844855236065i,2.02558352996864 + 1.56424877948231i};

  std::array <std::complex<float>,ssb_nfft> pss_seq_ref_t_1 = {-1.00000000000000 + 0.00000000000000i,-5.47331107831098 - 9.84411089597471i,-11.1913751987546 - 1.71187471778555i,-6.77026573240680 + 12.0421248902170i,5.76303852554061 + 9.85663096674487i,13.4759847683106 - 3.75347936795002i,8.84755214289734 - 7.81719373786391i,-2.77470325590140 + 0.491547349461057i,-10.2276458561217 + 4.70646733462740i,-7.12172019108237 - 2.32937769755896i,2.65148921477748 - 10.4334693288181i,8.27981769852599 - 11.8699706770650i,3.96694732931443 - 10.8484646654518i,-2.89176293794595 - 11.6402382020580i,-1.15066377319588 - 11.5351231720892i,7.67248108945205 - 7.88063477449775i,11.5160807208924 - 1.88382510878848i,6.52218174593093 + 5.04872576829450i,2.28785994476883 + 10.6799856211212i,5.62653237336524 + 9.77887975273393i,10.8577951211524 + 0.818766871653734i,10.9520971263999 - 8.34752450586883i,7.05871372382690 - 9.86920204386705i,1.63087600835391 - 7.02992849642516i,-6.42035253670194 - 7.39674906662299i,-13.7660309751284 - 9.50858263285062i,-12.0114172392056 - 6.19212915519980i,-2.08390041920985 + 2.60137557170922i,3.18292964612356 + 9.99992718571332i,-1.20928304016722 + 12.4614641399692i,-3.56489732419499 + 11.5439453013850i,3.87634321645805 + 8.77827085441109i,10.0208152801713 + 6.12132034355964i,4.00618134831581 + 7.01873387741433i,-4.40836018795676 + 10.0585194310449i,-0.557022447888013 + 7.75050317364070i,9.56429174099717 - 0.869538913907146i,8.52644400608524 - 4.45983319639078i,-4.32201568471860 + 4.21274748214057i,-12.9731767516584 + 14.4586368583378i,-9.81935764388389 + 11.9642962821461i,-2.68228020074089 - 0.567426490968559i,1.96544903655094 - 9.70554656403885i,5.79456246255546 - 11.1712399111790i,7.88931981850662 - 9.70601515312216i,3.03375951235730 - 5.60264217382097i,-6.39244895254433 + 3.42138632637433i,-10.0750213318243 + 11.7439795224398i,-4.70387095777035 + 12.3570513112459i,1.77094684749694 + 9.57229838736069i,3.40903546940824 + 10.4114875915787i,3.46726259818560 + 9.04374116080166i,5.81023638794935 - 2.70423896649077i,8.81437740483340 - 14.7110399644103i,10.5296077956155 - 9.68418589800755i,11.3630467324334 + 7.17670426717723i,9.64713707190980 + 12.5995416408519i,2.97843708026702 + 0.720122382842842i,-4.37137066165710 - 9.61897567995775i,-4.17749358241600 - 7.72904430048784i,3.41786861831513 - 6.22287386215166i,8.78343072695028 - 13.4981403144198i,6.37841660645265 - 15.6996834435559i,1.02819120857150 - 2.32717629763020i,-2.00000000000000 + 11.0000000000000i,-4.12059345808667 + 6.06953397999888i,-6.42060753563634 - 7.24390286745456i,-4.52052846866466 - 6.83734814387697i,2.73925450288316 + 5.62528745693589i,6.45839387077677 + 9.11435036996946i,-1.57902318119488 - 1.26976930193428i,-14.6302979929863 - 7.93458174469899i,-16.7086045308305 - 1.16667057714390i,-3.46956452295331 + 6.77300469630859i,10.2315992812773 + 4.21454373331005i,8.27383674662998 - 2.26258551627680i,-5.57520625654750 - 2.17836472770627i,-11.6528923099985 + 1.99837010250523i,0.0422170979780556 + 3.33093013329064i,16.0288305383376 + 3.69221326624415i,16.7038709577704 + 6.70019706175354i,1.90931854883839 + 7.16806558871353i,-10.3503324930229 + 0.626759086122149i,-8.66693886306923 - 4.26278897878464i,0.0293678068656957 + 2.58777669605492i,5.51944537650944 + 13.4524244304732i,8.46027054648140 + 11.3217976334419i,12.5137261618422 - 3.46149193564916i,13.2103939039742 - 11.6789810180082i,5.73015607844254 - 3.32405086258632i,-2.95738811478765 + 8.70789254650120i,-1.87035442580149 + 9.92603841141813i,6.93034203622490 + 4.81962020812040i,10.1256981242995 + 5.20398452439286i,1.58210390294372 + 9.33467299307272i,-10.2307533099567 + 6.83247109193132i,-14.0208152801713 - 1.87867965644036i,-7.49576603562223 - 5.64418151002769i,3.42268468828998 - 0.261110273202585i,11.0932732949255 + 6.63274877324093i,11.1045090968350 + 8.90701378756027i,5.38652753012552 + 9.20722041175520i,0.277407654357958 + 10.7266201200608i,-1.67417740112608 + 10.9971007702754i,-4.97068372338835 + 7.58739063119219i,-11.8264874631753 + 3.52848409188326i,-14.8604447905440 + 3.37891413721531i,-7.35839238053947 + 7.38860391792920i,3.34645217131677 + 11.2354936386723i,3.85335105960026 + 9.59486082486525i,-5.16849249519295 + 1.18300523172052i,-8.78438319030685 - 7.56048230085050i,0.483919279107635 - 7.54067935828086i,12.3465603856973 + 0.910609101573737i,14.6682543051553 + 6.90068215748101i,9.37327385669847 + 4.96164182653211i,5.67508762144228 + 3.80034449117413i,5.83060546482238 + 10.4835892539666i,6.18203112902129 + 15.6588783874250i,6.58071900759501 + 8.41737673330408i,9.28911331504240 - 2.43232788539885i,11.2481908521660 - 0.422679520970770i,6.52495614527124 + 10.3010459544139i,-3.63038960927716 + 10.5383848951354i,-10.7022341669195 - 1.07728023434817i,-10.0246157886334 - 4.97230148729020i,-5.77081105246754 + 5.25399566073764i,-3.36275368727747 + 10.7751630996225i,-3.00000000000000 + 0.00000000000000i,-3.36275368727747 - 10.7751630996225i,-5.77081105246754 - 5.25399566073764i,-10.0246157886335 + 4.97230148729020i,-10.7022341669195 + 1.07728023434817i,-3.63038960927716 - 10.5383848951354i,6.52495614527124 - 10.3010459544139i,11.2481908521660 + 0.422679520970771i,9.28911331504240 + 2.43232788539885i,6.58071900759501 - 8.41737673330408i,6.18203112902129 - 15.6588783874250i,5.83060546482238 - 10.4835892539666i,5.67508762144228 - 3.80034449117413i,9.37327385669847 - 4.96164182653211i,14.6682543051553 - 6.90068215748101i,12.3465603856973 - 0.910609101573736i,0.483919279107635 + 7.54067935828086i,-8.78438319030686 + 7.56048230085050i,-5.16849249519295 - 1.18300523172052i,3.85335105960026 - 9.59486082486525i,3.34645217131677 - 11.2354936386723i,-7.35839238053946 - 7.38860391792920i,-14.8604447905440 - 3.37891413721531i,-11.8264874631753 - 3.52848409188326i,-4.97068372338835 - 7.58739063119219i,-1.67417740112608 - 10.9971007702754i,0.277407654357955 - 10.7266201200608i,5.38652753012552 - 9.20722041175520i,11.1045090968350 - 8.90701378756027i,11.0932732949255 - 6.63274877324093i,3.42268468828997 + 0.261110273202586i,-7.49576603562223 + 5.64418151002769i,-14.0208152801713 + 1.87867965644036i,-10.2307533099567 - 6.83247109193132i,1.58210390294372 - 9.33467299307272i,10.1256981242995 - 5.20398452439286i,6.93034203622490 - 4.81962020812040i,-1.87035442580149 - 9.92603841141813i,-2.95738811478764 - 8.70789254650120i,5.73015607844255 + 3.32405086258632i,13.2103939039742 + 11.6789810180083i,12.5137261618422 + 3.46149193564916i,8.46027054648140 - 11.3217976334419i,5.51944537650944 - 13.4524244304732i,0.0293678068656944 - 2.58777669605492i,-8.66693886306923 + 4.26278897878464i,-10.3503324930229 - 0.626759086122151i,1.90931854883839 - 7.16806558871353i,16.7038709577704 - 6.70019706175354i,16.0288305383376 - 3.69221326624415i,0.0422170979780558 - 3.33093013329064i,-11.6528923099985 - 1.99837010250522i,-5.57520625654750 + 2.17836472770626i,8.27383674662998 + 2.26258551627681i,10.2315992812773 - 4.21454373331005i,-3.46956452295331 - 6.77300469630859i,-16.7086045308305 + 1.16667057714390i,-14.6302979929863 + 7.93458174469899i,-1.57902318119488 + 1.26976930193428i,6.45839387077677 - 9.11435036996946i,2.73925450288316 - 5.62528745693589i,-4.52052846866466 + 6.83734814387698i,-6.42060753563634 + 7.24390286745456i,-4.12059345808667 - 6.06953397999889i,-2.00000000000000 - 11.0000000000000i,1.02819120857150 + 2.32717629763020i,6.37841660645265 + 15.6996834435559i,8.78343072695028 + 13.4981403144198i,3.41786861831513 + 6.22287386215166i,-4.17749358241600 + 7.72904430048783i,-4.37137066165710 + 9.61897567995776i,2.97843708026702 - 0.720122382842841i,9.64713707190980 - 12.5995416408519i,11.3630467324334 - 7.17670426717723i,10.5296077956155 + 9.68418589800755i,8.81437740483340 + 14.7110399644103i,5.81023638794935 + 2.70423896649077i,3.46726259818561 - 9.04374116080166i,3.40903546940824 - 10.4114875915787i,1.77094684749694 - 9.57229838736069i,-4.70387095777035 - 12.3570513112459i,-10.0750213318243 - 11.7439795224398i,-6.39244895254433 - 3.42138632637433i,3.03375951235730 + 5.60264217382097i,7.88931981850662 + 9.70601515312215i,5.79456246255546 + 11.1712399111790i,1.96544903655094 + 9.70554656403885i,-2.68228020074089 + 0.567426490968557i,-9.81935764388389 - 11.9642962821461i,-12.9731767516584 - 14.4586368583378i,-4.32201568471860 - 4.21274748214057i,8.52644400608524 + 4.45983319639078i,9.56429174099717 + 0.869538913907148i,-0.557022447888014 - 7.75050317364070i,-4.40836018795676 - 10.0585194310449i,4.00618134831581 - 7.01873387741433i,10.0208152801713 - 6.12132034355964i,3.87634321645805 - 8.77827085441109i,-3.56489732419499 - 11.5439453013850i,-1.20928304016722 - 12.4614641399692i,3.18292964612356 - 9.99992718571331i,-2.08390041920985 - 2.60137557170922i,-12.0114172392056 + 6.19212915519980i,-13.7660309751284 + 9.50858263285062i,-6.42035253670194 + 7.39674906662299i,1.63087600835391 + 7.02992849642516i,7.05871372382691 + 9.86920204386705i,10.9520971263999 + 8.34752450586883i,10.8577951211524 - 0.818766871653735i,5.62653237336524 - 9.77887975273393i,2.28785994476883 - 10.6799856211212i,6.52218174593093 - 5.04872576829450i,11.5160807208924 + 1.88382510878848i,7.67248108945205 + 7.88063477449775i,-1.15066377319587 + 11.5351231720892i,-2.89176293794594 + 11.6402382020580i,3.96694732931443 + 10.8484646654518i,8.27981769852599 + 11.8699706770650i,2.65148921477748 + 10.4334693288181i,-7.12172019108237 + 2.32937769755896i,-10.2276458561217 - 4.70646733462740i,-2.77470325590140 - 0.491547349461057i,8.84755214289734 + 7.81719373786391i,13.4759847683106 + 3.75347936795003i,5.76303852554061 - 9.85663096674487i,-6.77026573240681 - 12.0421248902170i,-11.1913751987546 + 1.71187471778555i,-5.47331107831098 + 9.84411089597470i};

  std::array <std::complex<float>,ssb_nfft> pss_seq_ref_t_2 = {-1.00000000000000 + 0.00000000000000i,2.54960973976398 + 11.4730063320961i,4.72373236322565 + 10.4027023435530i,-3.14136978392857 + 3.57859649010713i,-11.1684032876186 + 1.33701567162675i,-5.94898264450205 - 0.931124047163525i,7.05544568713142 - 8.08716376629921i,12.9275409755594 - 8.97875477035739i,10.1588357451667 + 4.38367160256721i,8.10842151311103 + 16.1649635104753i,8.90392747954262 + 8.31056448634214i,7.02595340742398 - 8.91678222057911i,1.58227428429436 - 11.9868779129762i,-3.72075457261583 - 0.281915256263582i,-7.67609915393493 + 7.76774574626659i,-8.78773322790789 + 7.53398420537136i,-3.06773919172440 + 10.3481817416554i,6.11198546977574 + 16.1429845793535i,6.50454841914189 + 11.6505668480455i,-4.02696141537541 - 2.25214948239551i,-9.63638224625775 - 7.45983514122218i,-0.692713345859703 + 1.46959434349511i,8.26810821900154 + 7.93128565105486i,1.72648450190627 + 1.83957185708847i,-9.69385265560847 - 4.29192575853501i,-6.87789553202789 + 1.20014356279195i,4.43630904695984 + 9.21972969647867i,3.50321134779060 + 7.56705129035778i,-8.98286919296038 + 2.35467753412605i,-11.8539175516109 + 5.19617627334978i,0.0271494071145062 + 10.8494270720297i,7.19968660440144 + 5.84732994766891i,-1.87867965644036 - 7.29289321881345i,-13.6302977422913 - 12.7384604246100i,-12.7161244769454 - 6.47136093372760i,-2.70588776411129 - 1.71811201289854i,5.74629703120170 - 6.55217470189751i,10.4088378574109 - 11.4284687073055i,11.5410229323444 - 6.56564861291360i,5.32857901282857 + 0.524836747837613i,-6.39012993603695 - 3.03715473112550i,-12.1744655802319 - 13.2087776455132i,-6.97595370819257 - 13.6054649269831i,-1.61939072152319 - 1.44313967976253i,-6.36243621502862 + 6.76118552819100i,-14.3697357746633 + 0.707534105585804i,-12.4595053234649 - 7.17385692389292i,-1.30763093187353 - 2.09340780738627i,6.39522689797245 + 8.13239225283570i,4.40686213485918 + 5.47276094635208i,-0.364862202354479 - 7.75695474187196i,0.892631865159910 - 11.4346352882952i,7.89907043230522 - 0.571737770090732i,12.6622871764907 + 5.94025644374563i,8.80027260803962 - 3.96488394312409i,-0.983981015488508 - 16.1650466888221i,-6.79725960424079 - 13.9595072826400i,-2.76651882058866 - 4.50662404656348i,4.99261739574215 - 5.08077126405615i,5.94824992842662 - 14.2237850138951i,-0.638104167377387 - 15.2486045864500i,-5.75676231867406 - 3.30138154187188i,-4.90158126083019 + 8.58669086477147i,-3.91770987274177 + 9.96355352805103i,-8.00000000000000 + 5.00000000000000i,-13.0521801963305 + 1.96092434001075i,-13.0418259934891 + 1.66691343973989i,-9.42789508681680 - 0.0904900000621953i,-7.14315636131988 - 5.45627741394205i,-6.00137601341140 - 12.0797571927333i,-2.68745472530609 - 14.1287531258953i,1.66851536445376 - 6.90048748864819i,2.23465046889669 + 5.91681035168886i,-2.38200835244109 + 12.9611891525153i,-8.54880340817190 + 7.98046134994937i,-12.1810841371555 - 2.18360382761212i,-11.0923999721474 - 7.64307606785882i,-4.73851107601854 - 8.12107758357271i,3.55631044559772 - 8.79307679385676i,5.86004512830545 - 9.47470045349393i,-2.39522689797245 - 7.18131624614906i,-13.4497086445778 - 4.87588033080686i,-13.3322234954860 - 7.26312829093494i,0.122858964323553 - 10.6651935233281i,11.8696613430694 - 7.52772959519849i,7.88953885626234 + 0.500805344625617i,-5.88038112680220 + 4.21601014956930i,-10.7245341298128 + 1.14579377126963i,0.500235352370041 - 1.61334081580765i,14.9439676095688 + 0.538900372428675i,17.1529627410098 + 3.86075727683081i,6.66343171406079 + 4.02520357903136i,-5.77032406848512 + 2.02786008527483i,-12.4243987095002 + 0.649798226214447i,-12.9759758153305 + 1.18143851039837i,-9.80547144944601 + 4.31683675802872i,-6.12132034355964 + 8.70710678118655i,-5.95838908891143 + 9.45989159198780i,-9.61257509619782 + 4.47303166175101i,-11.0369115502043 + 0.518684883886059i,-5.25892175915828 + 4.87096150953090i,4.09736409152316 + 12.2277996982596i,10.0411451905391 + 10.0177324962395i,11.3210311279975 - 2.61619198043760i,9.92689298978300 - 11.8386745916943i,4.32861899115268 - 8.29238587298316i,-5.59187199696030 + 0.613648806519471i,-10.9575683390018 + 2.75267363759734i,-3.15252117336995 - 2.57792483718756i,10.9798262467746 - 7.00448755558835i,16.0302115251411 - 5.63201388823986i,10.2747190964022 - 0.760457047449840i,7.06773919172440 + 3.03447324267061i,11.6529864266411 + 2.15811818859431i,12.1421451432535 - 4.33875075712016i,0.516562956442499 - 11.6514817926607i,-11.7935579538805 - 11.2010992823050i,-10.4606098679957 - 0.812384493909128i,0.210908808992953 + 9.89887037850835i,5.00311780023192 + 9.68322505270019i,0.0606276396697387 - 0.710573511581063i,-5.50118126357124 - 10.3244625325208i,-6.46342114793136 - 11.9814761979414i,-7.15455143186521 - 8.69089637612308i,-10.0982266932668 - 6.24811646661760i,-9.74620630319505 - 5.55942739350062i,-1.15815848138022 - 4.42333501804178i,11.1623683472224 - 2.27979390781230i,17.0000000000000 + 0.00000000000000i,11.1623683472224 + 2.27979390781230i,-1.15815848138022 + 4.42333501804178i,-9.74620630319505 + 5.55942739350062i,-10.0982266932668 + 6.24811646661760i,-7.15455143186521 + 8.69089637612308i,-6.46342114793136 + 11.9814761979414i,-5.50118126357124 + 10.3244625325208i,0.0606276396697405 + 0.710573511581062i,5.00311780023192 - 9.68322505270019i,0.210908808992951 - 9.89887037850834i,-10.4606098679957 + 0.812384493909126i,-11.7935579538805 + 11.2010992823050i,0.516562956442499 + 11.6514817926607i,12.1421451432535 + 4.33875075712016i,11.6529864266411 - 2.15811818859431i,7.06773919172440 - 3.03447324267061i,10.2747190964022 + 0.760457047449843i,16.0302115251411 + 5.63201388823986i,10.9798262467746 + 7.00448755558834i,-3.15252117336995 + 2.57792483718756i,-10.9575683390018 - 2.75267363759734i,-5.59187199696030 - 0.613648806519471i,4.32861899115269 + 8.29238587298316i,9.92689298978300 + 11.8386745916943i,11.3210311279975 + 2.61619198043760i,10.0411451905391 - 10.0177324962395i,4.09736409152316 - 12.2277996982596i,-5.25892175915828 - 4.87096150953090i,-11.0369115502043 - 0.518684883886057i,-9.61257509619782 - 4.47303166175101i,-5.95838908891142 - 9.45989159198780i,-6.12132034355964 - 8.70710678118655i,-9.80547144944601 - 4.31683675802872i,-12.9759758153305 - 1.18143851039837i,-12.4243987095002 - 0.649798226214447i,-5.77032406848513 - 2.02786008527483i,6.66343171406079 - 4.02520357903136i,17.1529627410098 - 3.86075727683082i,14.9439676095688 - 0.538900372428675i,0.500235352370043 + 1.61334081580765i,-10.7245341298128 - 1.14579377126963i,-5.88038112680220 - 4.21601014956930i,7.88953885626234 - 0.500805344625618i,11.8696613430694 + 7.52772959519849i,0.122858964323554 + 10.6651935233281i,-13.3322234954860 + 7.26312829093494i,-13.4497086445778 + 4.87588033080686i,-2.39522689797245 + 7.18131624614906i,5.86004512830545 + 9.47470045349393i,3.55631044559772 + 8.79307679385676i,-4.73851107601854 + 8.12107758357271i,-11.0923999721474 + 7.64307606785881i,-12.1810841371555 + 2.18360382761212i,-8.54880340817189 - 7.98046134994937i,-2.38200835244109 - 12.9611891525153i,2.23465046889669 - 5.91681035168886i,1.66851536445376 + 6.90048748864818i,-2.68745472530609 + 14.1287531258953i,-6.00137601341140 + 12.0797571927333i,-7.14315636131988 + 5.45627741394205i,-9.42789508681681 + 0.0904900000621970i,-13.0418259934891 - 1.66691343973989i,-13.0521801963305 - 1.96092434001074i,-8.00000000000000 - 5.00000000000000i,-3.91770987274177 - 9.96355352805103i,-4.90158126083019 - 8.58669086477147i,-5.75676231867406 + 3.30138154187188i,-0.638104167377387 + 15.2486045864500i,5.94824992842662 + 14.2237850138951i,4.99261739574216 + 5.08077126405615i,-2.76651882058866 + 4.50662404656348i,-6.79725960424079 + 13.9595072826400i,-0.983981015488508 + 16.1650466888221i,8.80027260803963 + 3.96488394312409i,12.6622871764907 - 5.94025644374562i,7.89907043230522 + 0.571737770090731i,0.892631865159909 + 11.4346352882952i,-0.364862202354477 + 7.75695474187196i,4.40686213485918 - 5.47276094635207i,6.39522689797245 - 8.13239225283570i,-1.30763093187353 + 2.09340780738627i,-12.4595053234649 + 7.17385692389292i,-14.3697357746633 - 0.707534105585804i,-6.36243621502862 - 6.76118552819100i,-1.61939072152319 + 1.44313967976253i,-6.97595370819257 + 13.6054649269831i,-12.1744655802319 + 13.2087776455132i,-6.39012993603695 + 3.03715473112550i,5.32857901282857 - 0.524836747837614i,11.5410229323444 + 6.56564861291360i,10.4088378574109 + 11.4284687073055i,5.74629703120170 + 6.55217470189751i,-2.70588776411129 + 1.71811201289854i,-12.7161244769454 + 6.47136093372760i,-13.6302977422913 + 12.7384604246100i,-1.87867965644036 + 7.29289321881345i,7.19968660440144 - 5.84732994766892i,0.0271494071145089 - 10.8494270720297i,-11.8539175516109 - 5.19617627334978i,-8.98286919296038 - 2.35467753412605i,3.50321134779060 - 7.56705129035778i,4.43630904695984 - 9.21972969647867i,-6.87789553202789 - 1.20014356279195i,-9.69385265560847 + 4.29192575853501i,1.72648450190627 - 1.83957185708847i,8.26810821900154 - 7.93128565105486i,-0.692713345859703 - 1.46959434349511i,-9.63638224625776 + 7.45983514122218i,-4.02696141537541 + 2.25214948239551i,6.50454841914189 - 11.6505668480455i,6.11198546977574 - 16.1429845793535i,-3.06773919172440 - 10.3481817416554i,-8.78773322790789 - 7.53398420537136i,-7.67609915393493 - 7.76774574626658i,-3.72075457261583 + 0.281915256263580i,1.58227428429436 + 11.9868779129762i,7.02595340742398 + 8.91678222057911i,8.90392747954262 - 8.31056448634214i,8.10842151311103 - 16.1649635104753i,10.1588357451667 - 4.38367160256721i,12.9275409755594 + 8.97875477035739i,7.05544568713142 + 8.08716376629921i,-5.94898264450205 + 0.931124047163527i,-11.1684032876186 - 1.33701567162675i,-3.14136978392857 - 3.57859649010713i,4.72373236322565 - 10.4027023435530i,2.54960973976398 - 11.4730063320961i};



  for (int i = 0; i < pss_seq_t_0.size(); ++i) {
    EXPECT_NEAR((pss_seq_t_0.at(i)).real(), (pss_seq_ref_t_0.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((pss_seq_t_0.at(i)).imag(), (pss_seq_ref_t_0.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

for (int i = 0; i < pss_seq_t_1.size(); ++i) {
    EXPECT_NEAR((pss_seq_t_1.at(i)).real(), (pss_seq_ref_t_1.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((pss_seq_t_1.at(i)).imag(), (pss_seq_ref_t_1.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

for (int i = 0; i < pss_seq_t_2.size(); ++i) {
    EXPECT_NEAR((pss_seq_t_2.at(i)).real(), (pss_seq_ref_t_2.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((pss_seq_t_2.at(i)).imag(), (pss_seq_ref_t_2.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

}


TEST_F(pss_test, test_pss_nondefault_constructor) {

  pss pss1(0);

  std::array <std::complex<float>,pss::pss_length> pss_seq_f_0 = pss1.get_pss_seq_f();
  
  std::array <std::complex<float>,ssb_nfft> pss_seq_t_0 = pss1.get_pss_seq_t();

  std::array <std::complex<float>,pss::pss_length> pss_seq_ref_f_0 = {1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,-1};

  std::array <std::complex<float>,ssb_nfft> pss_seq_ref_t_0 = {-1.00000000000000 + 0.00000000000000i,2.02558352996864 - 1.56424877948230i,7.11664163067063 - 8.61844855236065i,8.20746854172450 - 13.9971597069576i,5.86815146579919 - 9.95129793803779i,5.68326173247147 - 3.65121225383105i,8.92969744261807 - 6.39487978176359i,9.76348813238836 - 13.5671423637555i,3.31958637956890 - 11.5144145604235i,-6.70981085159678 - 1.52707352549082i,-11.3553311255104 + 0.997346022709846i,-6.12415677158348 - 7.16890182755759i,4.36381885790567 - 10.4402266081634i,11.1033309914266 - 0.745632768202043i,9.14910082029709 + 7.47904209133319i,1.73236532085041 + 0.740971288923854i,-3.63872960283282 - 10.0782015624102i,-3.34724081185858 - 6.21488746752687i,-1.13226666067816 + 9.29899778497225i,-2.44934827940739 + 16.8861867279957i,-7.16412340595267 + 9.83525725510715i,-10.6288355284770 - 0.0499835821814396i,-10.5758365558144 - 4.26781618034310i,-8.64270554215701 - 6.81501804896653i,-5.37297607698243 - 10.1133299672529i,1.04161159653810 - 8.99707803688757i,9.57176395311536 - 3.21376996310209i,14.6627879457409 - 0.778433484606541i,12.2282267385866 - 3.20007138832974i,3.99633292353357 - 1.44455670821010i,-5.49478522154995 + 6.77657313581141i,-12.3007803739160 + 9.95548880621288i,-12.6066017177982 + 2.12132034355964i,-4.47869507621121 - 4.37979537035737i,7.43633818499241 + 2.06012819027932i,14.1478762222519 + 11.6936067209483i,12.2054437587054 + 7.50289599306383i,6.96430558837228 - 7.15354087760464i,4.27231406138905 - 12.4428809757101i,4.51761913323122 - 1.98210359719058i,6.44566321350236 + 8.19746814135188i,9.57784103253549 + 4.48548059583750i,10.4761665009709 - 4.96058146796508i,4.98755732881285 - 4.23297325331709i,-2.72738926062222 + 6.84898661728365i,-3.05885200311417 + 14.5792733840486i,3.28271853333215 + 12.2863558584987i,3.85135975284877 + 7.42129688208745i,-5.50721115130182 + 6.60685419694907i,-12.4518470885752 + 4.60906998875368i,-8.44267434995982 - 5.00011965539262i,-2.84407898939727 - 15.5274117636921i,-4.69478695319596 - 14.1619903864122i,-5.27184666660217 - 1.46346659303286i,4.31837557781476 + 7.29974248108759i,11.5898975675211 + 2.87697237816168i,0.576021479392856 - 6.00425613830549i,-17.8947114399093 - 6.96023265498315i,-18.5284134838684 - 1.23758826643414i,-0.292492452226088 + 1.79948372352903i,12.1840694578413 + 0.735970094230532i,6.45376312037222 + 2.18144735193755i,-2.78856100591117 + 8.02366912023641i,-1.07335431797422 + 12.4889476784899i,6.00000000000000 + 11.0000000000000i,8.15449952398854 + 4.24969890550508i,6.41452849745064 - 5.18115506013030i,4.32446407089909 - 13.2261602151734i,-0.840372112187851 - 13.7523046749739i,-8.88387534973292 - 5.46237684219512i,-12.2362763005720 + 2.81073210007806i,-8.71249448824609 + 1.81626554282104i,-6.46591606305976 - 5.36431924185585i,-9.75032295140657 - 8.49407933434317i,-12.1752753199026 - 4.98490682201433i,-9.73812158508971 + 0.0180211890830881i,-7.36796527990047 + 4.92824994361506i,-7.08537955113193 + 11.3395595576996i,-3.76471610842269 + 14.4633288596562i,1.64336737667773 + 7.26935158194068i,-0.149643098190562 - 5.39314580305093i,-9.33169198226154 - 9.70970832349642i,-13.3127990678197 - 1.92954856632051i,-7.99034443942197 + 7.14950613949475i,-5.63008046998733 + 8.55734851763694i,-12.2654797916697 + 4.37440302473756i,-15.2805722448123 - 1.22603421571935i,-5.83496940674020 - 7.70882927990730i,3.77380017133413 - 12.0676024002205i,0.222626676276989 - 9.41309707706915i,-9.01588727320339 - 3.32600050612093i,-10.5083701854238 - 3.39781890834116i,-7.20728377348613 - 8.67469271936294i,-7.96110620546904 - 6.84162390164449i,-7.87486298714269 + 4.78411105681542i,0.694435370733648 + 11.3972676555851i,8.60660171779821 + 2.12132034355964i,3.34035602138443 - 12.8338248561052i,-6.51125184045658 - 16.4649093950576i,-3.35304020933449 - 7.22923947490276i,8.46249773308436 + 2.79544867951437i,8.44723870788653 + 5.04855676262190i,-4.98190849807518 + 1.02867943137327i,-10.6190894215490 - 3.15847686101143i,0.810366941638324 - 2.09412926136344i,11.7148660357578 + 4.78969526184461i,5.81951972352688 + 10.6267218141132i,-8.55026671164935 + 8.40838249034696i,-14.4968601214976 + 2.35921677869828i,-10.0771329450525 + 3.09700333274613i,-3.48940970325470 + 9.95223999498101i,2.74571308988567 + 10.5616839223324i,9.29558385232520 + 1.92179843758976i,10.5366022288773 - 2.90988645945281i,1.71004653650579 + 3.18422024324044i,-8.82659449113825 + 7.78907630117003i,-7.53744736268847 - 0.534388654898250i,4.82739286691052 - 11.1818533543223i,12.7729534437272 - 6.75472953615100i,7.04071351880692 + 9.30959900952301i,-3.08654604539438 + 17.4097935834881i,-3.30455959145099 + 10.0702494288407i,5.98871009859653 - 0.593573492395652i,10.6909008722596 - 3.49637543823584i,2.35410072759619 - 2.26646392697137i,-10.5873587567409 - 4.68137331684454i,-14.2980472580533 - 9.16132113216296i,-7.74067256441843 - 8.15115830372091i,-3.00000000000000 + 0.00000000000000i,-7.74067256441843 + 8.15115830372092i,-14.2980472580533 + 9.16132113216296i,-10.5873587567409 + 4.68137331684454i,2.35410072759619 + 2.26646392697137i,10.6909008722596 + 3.49637543823584i,5.98871009859653 + 0.593573492395649i,-3.30455959145099 - 10.0702494288407i,-3.08654604539437 - 17.4097935834880i,7.04071351880692 - 9.30959900952301i,12.7729534437272 + 6.75472953615100i,4.82739286691052 + 11.1818533543223i,-7.53744736268846 + 0.534388654898251i,-8.82659449113825 - 7.78907630117003i,1.71004653650579 - 3.18422024324044i,10.5366022288773 + 2.90988645945281i,9.29558385232520 - 1.92179843758976i,2.74571308988567 - 10.5616839223324i,-3.48940970325470 - 9.95223999498101i,-10.0771329450525 - 3.09700333274613i,-14.4968601214976 - 2.35921677869828i,-8.55026671164935 - 8.40838249034696i,5.81951972352688 - 10.6267218141132i,11.7148660357578 - 4.78969526184461i,0.810366941638325 + 2.09412926136343i,-10.6190894215490 + 3.15847686101143i,-4.98190849807518 - 1.02867943137327i,8.44723870788653 - 5.04855676262190i,8.46249773308436 - 2.79544867951437i,-3.35304020933449 + 7.22923947490275i,-6.51125184045658 + 16.4649093950576i,3.34035602138443 + 12.8338248561052i,8.60660171779821 - 2.12132034355964i,0.694435370733646 - 11.3972676555851i,-7.87486298714270 - 4.78411105681542i,-7.96110620546904 + 6.84162390164448i,-7.20728377348613 + 8.67469271936294i,-10.5083701854238 + 3.39781890834116i,-9.01588727320339 + 3.32600050612093i,0.222626676276988 + 9.41309707706915i,3.77380017133413 + 12.0676024002205i,-5.83496940674020 + 7.70882927990730i,-15.2805722448123 + 1.22603421571935i,-12.2654797916697 - 4.37440302473756i,-5.63008046998733 - 8.55734851763694i,-7.99034443942197 - 7.14950613949475i,-13.3127990678197 + 1.92954856632052i,-9.33169198226154 + 9.70970832349642i,-0.149643098190562 + 5.39314580305093i,1.64336737667773 - 7.26935158194068i,-3.76471610842269 - 14.4633288596562i,-7.08537955113193 - 11.3395595576996i,-7.36796527990047 - 4.92824994361506i,-9.73812158508971 - 0.0180211890830879i,-12.1752753199026 + 4.98490682201433i,-9.75032295140656 + 8.49407933434317i,-6.46591606305976 + 5.36431924185585i,-8.71249448824609 - 1.81626554282104i,-12.2362763005720 - 2.81073210007806i,-8.88387534973292 + 5.46237684219512i,-0.840372112187852 + 13.7523046749739i,4.32446407089909 + 13.2261602151734i,6.41452849745064 + 5.18115506013030i,8.15449952398853 - 4.24969890550508i,6.00000000000000 - 11.0000000000000i,-1.07335431797422 - 12.4889476784899i,-2.78856100591117 - 8.02366912023641i,6.45376312037222 - 2.18144735193756i,12.1840694578413 - 0.735970094230531i,-0.292492452226085 - 1.79948372352903i,-18.5284134838684 + 1.23758826643414i,-17.8947114399093 + 6.96023265498315i,0.576021479392855 + 6.00425613830548i,11.5898975675211 - 2.87697237816168i,4.31837557781476 - 7.29974248108759i,-5.27184666660217 + 1.46346659303286i,-4.69478695319596 + 14.1619903864122i,-2.84407898939727 + 15.5274117636921i,-8.44267434995982 + 5.00011965539262i,-12.4518470885752 - 4.60906998875368i,-5.50721115130182 - 6.60685419694907i,3.85135975284877 - 7.42129688208745i,3.28271853333215 - 12.2863558584987i,-3.05885200311417 - 14.5792733840486i,-2.72738926062222 - 6.84898661728365i,4.98755732881285 + 4.23297325331709i,10.4761665009709 + 4.96058146796508i,9.57784103253549 - 4.48548059583750i,6.44566321350236 - 8.19746814135188i,4.51761913323122 + 1.98210359719058i,4.27231406138905 + 12.4428809757101i,6.96430558837228 + 7.15354087760464i,12.2054437587054 - 7.50289599306383i,14.1478762222519 - 11.6936067209483i,7.43633818499241 - 2.06012819027932i,-4.47869507621121 + 4.37979537035737i,-12.6066017177982 - 2.12132034355964i,-12.3007803739160 - 9.95548880621288i,-5.49478522154995 - 6.77657313581141i,3.99633292353357 + 1.44455670821009i,12.2282267385866 + 3.20007138832974i,14.6627879457409 + 0.778433484606540i,9.57176395311537 + 3.21376996310209i,1.04161159653809 + 8.99707803688757i,-5.37297607698243 + 10.1133299672530i,-8.64270554215701 + 6.81501804896653i,-10.5758365558144 + 4.26781618034310i,-10.6288355284770 + 0.0499835821814396i,-7.16412340595267 - 9.83525725510715i,-2.44934827940739 - 16.8861867279957i,-1.13226666067816 - 9.29899778497225i,-3.34724081185857 + 6.21488746752687i,-3.63872960283282 + 10.0782015624102i,1.73236532085042 - 0.740971288923854i,9.14910082029709 - 7.47904209133319i,11.1033309914266 + 0.745632768202041i,4.36381885790567 + 10.4402266081634i,-6.12415677158348 + 7.16890182755759i,-11.3553311255104 - 0.997346022709846i,-6.70981085159678 + 1.52707352549082i,3.31958637956890 + 11.5144145604235i,9.76348813238836 + 13.5671423637555i,8.92969744261807 + 6.39487978176359i,5.68326173247147 + 3.65121225383105i,5.86815146579919 + 9.95129793803778i,8.20746854172451 + 13.9971597069576i,7.11664163067063 + 8.61844855236065i,2.02558352996864 + 1.56424877948231i};


  for (int i = 0; i < pss_seq_f_0.size(); ++i) {
    EXPECT_FLOAT_EQ((pss_seq_f_0.at(i)).real(), (pss_seq_ref_f_0.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((pss_seq_f_0.at(i)).imag(), (pss_seq_ref_f_0.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < pss_seq_t_0.size(); ++i) {
    EXPECT_NEAR((pss_seq_t_0.at(i)).real(), (pss_seq_ref_t_0.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((pss_seq_t_0.at(i)).imag(), (pss_seq_ref_t_0.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

}



TEST_F(pss_test, test_pss_init_all) {

  pss pss1;

  pss1.init_all_seq();

  std::array <std::array<std::complex<float>,pss::pss_length>,nid_2_max + 1> pss_f_matrix = pss1.get_pss_seq_f_matrix();
  
  std::array <std::array<std::complex<float>,ssb_nfft>,nid_2_max + 1> pss_t_matrix = pss1.get_pss_seq_t_matrix();

  std::array <std::complex<float>,pss::pss_length> pss_seq_ref_f_0 = {1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,-1};
  
  std::array <std::complex<float>,pss::pss_length> pss_seq_ref_f_1 = {1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1};
  
  std::array <std::complex<float>,pss::pss_length> pss_seq_ref_f_2 = {-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,-1,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,1,1,-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1};


  std::array <std::complex<float>,ssb_nfft> pss_seq_ref_t_0 = {-1.00000000000000 + 0.00000000000000i,2.02558352996864 - 1.56424877948230i,7.11664163067063 - 8.61844855236065i,8.20746854172450 - 13.9971597069576i,5.86815146579919 - 9.95129793803779i,5.68326173247147 - 3.65121225383105i,8.92969744261807 - 6.39487978176359i,9.76348813238836 - 13.5671423637555i,3.31958637956890 - 11.5144145604235i,-6.70981085159678 - 1.52707352549082i,-11.3553311255104 + 0.997346022709846i,-6.12415677158348 - 7.16890182755759i,4.36381885790567 - 10.4402266081634i,11.1033309914266 - 0.745632768202043i,9.14910082029709 + 7.47904209133319i,1.73236532085041 + 0.740971288923854i,-3.63872960283282 - 10.0782015624102i,-3.34724081185858 - 6.21488746752687i,-1.13226666067816 + 9.29899778497225i,-2.44934827940739 + 16.8861867279957i,-7.16412340595267 + 9.83525725510715i,-10.6288355284770 - 0.0499835821814396i,-10.5758365558144 - 4.26781618034310i,-8.64270554215701 - 6.81501804896653i,-5.37297607698243 - 10.1133299672529i,1.04161159653810 - 8.99707803688757i,9.57176395311536 - 3.21376996310209i,14.6627879457409 - 0.778433484606541i,12.2282267385866 - 3.20007138832974i,3.99633292353357 - 1.44455670821010i,-5.49478522154995 + 6.77657313581141i,-12.3007803739160 + 9.95548880621288i,-12.6066017177982 + 2.12132034355964i,-4.47869507621121 - 4.37979537035737i,7.43633818499241 + 2.06012819027932i,14.1478762222519 + 11.6936067209483i,12.2054437587054 + 7.50289599306383i,6.96430558837228 - 7.15354087760464i,4.27231406138905 - 12.4428809757101i,4.51761913323122 - 1.98210359719058i,6.44566321350236 + 8.19746814135188i,9.57784103253549 + 4.48548059583750i,10.4761665009709 - 4.96058146796508i,4.98755732881285 - 4.23297325331709i,-2.72738926062222 + 6.84898661728365i,-3.05885200311417 + 14.5792733840486i,3.28271853333215 + 12.2863558584987i,3.85135975284877 + 7.42129688208745i,-5.50721115130182 + 6.60685419694907i,-12.4518470885752 + 4.60906998875368i,-8.44267434995982 - 5.00011965539262i,-2.84407898939727 - 15.5274117636921i,-4.69478695319596 - 14.1619903864122i,-5.27184666660217 - 1.46346659303286i,4.31837557781476 + 7.29974248108759i,11.5898975675211 + 2.87697237816168i,0.576021479392856 - 6.00425613830549i,-17.8947114399093 - 6.96023265498315i,-18.5284134838684 - 1.23758826643414i,-0.292492452226088 + 1.79948372352903i,12.1840694578413 + 0.735970094230532i,6.45376312037222 + 2.18144735193755i,-2.78856100591117 + 8.02366912023641i,-1.07335431797422 + 12.4889476784899i,6.00000000000000 + 11.0000000000000i,8.15449952398854 + 4.24969890550508i,6.41452849745064 - 5.18115506013030i,4.32446407089909 - 13.2261602151734i,-0.840372112187851 - 13.7523046749739i,-8.88387534973292 - 5.46237684219512i,-12.2362763005720 + 2.81073210007806i,-8.71249448824609 + 1.81626554282104i,-6.46591606305976 - 5.36431924185585i,-9.75032295140657 - 8.49407933434317i,-12.1752753199026 - 4.98490682201433i,-9.73812158508971 + 0.0180211890830881i,-7.36796527990047 + 4.92824994361506i,-7.08537955113193 + 11.3395595576996i,-3.76471610842269 + 14.4633288596562i,1.64336737667773 + 7.26935158194068i,-0.149643098190562 - 5.39314580305093i,-9.33169198226154 - 9.70970832349642i,-13.3127990678197 - 1.92954856632051i,-7.99034443942197 + 7.14950613949475i,-5.63008046998733 + 8.55734851763694i,-12.2654797916697 + 4.37440302473756i,-15.2805722448123 - 1.22603421571935i,-5.83496940674020 - 7.70882927990730i,3.77380017133413 - 12.0676024002205i,0.222626676276989 - 9.41309707706915i,-9.01588727320339 - 3.32600050612093i,-10.5083701854238 - 3.39781890834116i,-7.20728377348613 - 8.67469271936294i,-7.96110620546904 - 6.84162390164449i,-7.87486298714269 + 4.78411105681542i,0.694435370733648 + 11.3972676555851i,8.60660171779821 + 2.12132034355964i,3.34035602138443 - 12.8338248561052i,-6.51125184045658 - 16.4649093950576i,-3.35304020933449 - 7.22923947490276i,8.46249773308436 + 2.79544867951437i,8.44723870788653 + 5.04855676262190i,-4.98190849807518 + 1.02867943137327i,-10.6190894215490 - 3.15847686101143i,0.810366941638324 - 2.09412926136344i,11.7148660357578 + 4.78969526184461i,5.81951972352688 + 10.6267218141132i,-8.55026671164935 + 8.40838249034696i,-14.4968601214976 + 2.35921677869828i,-10.0771329450525 + 3.09700333274613i,-3.48940970325470 + 9.95223999498101i,2.74571308988567 + 10.5616839223324i,9.29558385232520 + 1.92179843758976i,10.5366022288773 - 2.90988645945281i,1.71004653650579 + 3.18422024324044i,-8.82659449113825 + 7.78907630117003i,-7.53744736268847 - 0.534388654898250i,4.82739286691052 - 11.1818533543223i,12.7729534437272 - 6.75472953615100i,7.04071351880692 + 9.30959900952301i,-3.08654604539438 + 17.4097935834881i,-3.30455959145099 + 10.0702494288407i,5.98871009859653 - 0.593573492395652i,10.6909008722596 - 3.49637543823584i,2.35410072759619 - 2.26646392697137i,-10.5873587567409 - 4.68137331684454i,-14.2980472580533 - 9.16132113216296i,-7.74067256441843 - 8.15115830372091i,-3.00000000000000 + 0.00000000000000i,-7.74067256441843 + 8.15115830372092i,-14.2980472580533 + 9.16132113216296i,-10.5873587567409 + 4.68137331684454i,2.35410072759619 + 2.26646392697137i,10.6909008722596 + 3.49637543823584i,5.98871009859653 + 0.593573492395649i,-3.30455959145099 - 10.0702494288407i,-3.08654604539437 - 17.4097935834880i,7.04071351880692 - 9.30959900952301i,12.7729534437272 + 6.75472953615100i,4.82739286691052 + 11.1818533543223i,-7.53744736268846 + 0.534388654898251i,-8.82659449113825 - 7.78907630117003i,1.71004653650579 - 3.18422024324044i,10.5366022288773 + 2.90988645945281i,9.29558385232520 - 1.92179843758976i,2.74571308988567 - 10.5616839223324i,-3.48940970325470 - 9.95223999498101i,-10.0771329450525 - 3.09700333274613i,-14.4968601214976 - 2.35921677869828i,-8.55026671164935 - 8.40838249034696i,5.81951972352688 - 10.6267218141132i,11.7148660357578 - 4.78969526184461i,0.810366941638325 + 2.09412926136343i,-10.6190894215490 + 3.15847686101143i,-4.98190849807518 - 1.02867943137327i,8.44723870788653 - 5.04855676262190i,8.46249773308436 - 2.79544867951437i,-3.35304020933449 + 7.22923947490275i,-6.51125184045658 + 16.4649093950576i,3.34035602138443 + 12.8338248561052i,8.60660171779821 - 2.12132034355964i,0.694435370733646 - 11.3972676555851i,-7.87486298714270 - 4.78411105681542i,-7.96110620546904 + 6.84162390164448i,-7.20728377348613 + 8.67469271936294i,-10.5083701854238 + 3.39781890834116i,-9.01588727320339 + 3.32600050612093i,0.222626676276988 + 9.41309707706915i,3.77380017133413 + 12.0676024002205i,-5.83496940674020 + 7.70882927990730i,-15.2805722448123 + 1.22603421571935i,-12.2654797916697 - 4.37440302473756i,-5.63008046998733 - 8.55734851763694i,-7.99034443942197 - 7.14950613949475i,-13.3127990678197 + 1.92954856632052i,-9.33169198226154 + 9.70970832349642i,-0.149643098190562 + 5.39314580305093i,1.64336737667773 - 7.26935158194068i,-3.76471610842269 - 14.4633288596562i,-7.08537955113193 - 11.3395595576996i,-7.36796527990047 - 4.92824994361506i,-9.73812158508971 - 0.0180211890830879i,-12.1752753199026 + 4.98490682201433i,-9.75032295140656 + 8.49407933434317i,-6.46591606305976 + 5.36431924185585i,-8.71249448824609 - 1.81626554282104i,-12.2362763005720 - 2.81073210007806i,-8.88387534973292 + 5.46237684219512i,-0.840372112187852 + 13.7523046749739i,4.32446407089909 + 13.2261602151734i,6.41452849745064 + 5.18115506013030i,8.15449952398853 - 4.24969890550508i,6.00000000000000 - 11.0000000000000i,-1.07335431797422 - 12.4889476784899i,-2.78856100591117 - 8.02366912023641i,6.45376312037222 - 2.18144735193756i,12.1840694578413 - 0.735970094230531i,-0.292492452226085 - 1.79948372352903i,-18.5284134838684 + 1.23758826643414i,-17.8947114399093 + 6.96023265498315i,0.576021479392855 + 6.00425613830548i,11.5898975675211 - 2.87697237816168i,4.31837557781476 - 7.29974248108759i,-5.27184666660217 + 1.46346659303286i,-4.69478695319596 + 14.1619903864122i,-2.84407898939727 + 15.5274117636921i,-8.44267434995982 + 5.00011965539262i,-12.4518470885752 - 4.60906998875368i,-5.50721115130182 - 6.60685419694907i,3.85135975284877 - 7.42129688208745i,3.28271853333215 - 12.2863558584987i,-3.05885200311417 - 14.5792733840486i,-2.72738926062222 - 6.84898661728365i,4.98755732881285 + 4.23297325331709i,10.4761665009709 + 4.96058146796508i,9.57784103253549 - 4.48548059583750i,6.44566321350236 - 8.19746814135188i,4.51761913323122 + 1.98210359719058i,4.27231406138905 + 12.4428809757101i,6.96430558837228 + 7.15354087760464i,12.2054437587054 - 7.50289599306383i,14.1478762222519 - 11.6936067209483i,7.43633818499241 - 2.06012819027932i,-4.47869507621121 + 4.37979537035737i,-12.6066017177982 - 2.12132034355964i,-12.3007803739160 - 9.95548880621288i,-5.49478522154995 - 6.77657313581141i,3.99633292353357 + 1.44455670821009i,12.2282267385866 + 3.20007138832974i,14.6627879457409 + 0.778433484606540i,9.57176395311537 + 3.21376996310209i,1.04161159653809 + 8.99707803688757i,-5.37297607698243 + 10.1133299672530i,-8.64270554215701 + 6.81501804896653i,-10.5758365558144 + 4.26781618034310i,-10.6288355284770 + 0.0499835821814396i,-7.16412340595267 - 9.83525725510715i,-2.44934827940739 - 16.8861867279957i,-1.13226666067816 - 9.29899778497225i,-3.34724081185857 + 6.21488746752687i,-3.63872960283282 + 10.0782015624102i,1.73236532085042 - 0.740971288923854i,9.14910082029709 - 7.47904209133319i,11.1033309914266 + 0.745632768202041i,4.36381885790567 + 10.4402266081634i,-6.12415677158348 + 7.16890182755759i,-11.3553311255104 - 0.997346022709846i,-6.70981085159678 + 1.52707352549082i,3.31958637956890 + 11.5144145604235i,9.76348813238836 + 13.5671423637555i,8.92969744261807 + 6.39487978176359i,5.68326173247147 + 3.65121225383105i,5.86815146579919 + 9.95129793803778i,8.20746854172451 + 13.9971597069576i,7.11664163067063 + 8.61844855236065i,2.02558352996864 + 1.56424877948231i};

  std::array <std::complex<float>,ssb_nfft> pss_seq_ref_t_1 = {-1.00000000000000 + 0.00000000000000i,-5.47331107831098 - 9.84411089597471i,-11.1913751987546 - 1.71187471778555i,-6.77026573240680 + 12.0421248902170i,5.76303852554061 + 9.85663096674487i,13.4759847683106 - 3.75347936795002i,8.84755214289734 - 7.81719373786391i,-2.77470325590140 + 0.491547349461057i,-10.2276458561217 + 4.70646733462740i,-7.12172019108237 - 2.32937769755896i,2.65148921477748 - 10.4334693288181i,8.27981769852599 - 11.8699706770650i,3.96694732931443 - 10.8484646654518i,-2.89176293794595 - 11.6402382020580i,-1.15066377319588 - 11.5351231720892i,7.67248108945205 - 7.88063477449775i,11.5160807208924 - 1.88382510878848i,6.52218174593093 + 5.04872576829450i,2.28785994476883 + 10.6799856211212i,5.62653237336524 + 9.77887975273393i,10.8577951211524 + 0.818766871653734i,10.9520971263999 - 8.34752450586883i,7.05871372382690 - 9.86920204386705i,1.63087600835391 - 7.02992849642516i,-6.42035253670194 - 7.39674906662299i,-13.7660309751284 - 9.50858263285062i,-12.0114172392056 - 6.19212915519980i,-2.08390041920985 + 2.60137557170922i,3.18292964612356 + 9.99992718571332i,-1.20928304016722 + 12.4614641399692i,-3.56489732419499 + 11.5439453013850i,3.87634321645805 + 8.77827085441109i,10.0208152801713 + 6.12132034355964i,4.00618134831581 + 7.01873387741433i,-4.40836018795676 + 10.0585194310449i,-0.557022447888013 + 7.75050317364070i,9.56429174099717 - 0.869538913907146i,8.52644400608524 - 4.45983319639078i,-4.32201568471860 + 4.21274748214057i,-12.9731767516584 + 14.4586368583378i,-9.81935764388389 + 11.9642962821461i,-2.68228020074089 - 0.567426490968559i,1.96544903655094 - 9.70554656403885i,5.79456246255546 - 11.1712399111790i,7.88931981850662 - 9.70601515312216i,3.03375951235730 - 5.60264217382097i,-6.39244895254433 + 3.42138632637433i,-10.0750213318243 + 11.7439795224398i,-4.70387095777035 + 12.3570513112459i,1.77094684749694 + 9.57229838736069i,3.40903546940824 + 10.4114875915787i,3.46726259818560 + 9.04374116080166i,5.81023638794935 - 2.70423896649077i,8.81437740483340 - 14.7110399644103i,10.5296077956155 - 9.68418589800755i,11.3630467324334 + 7.17670426717723i,9.64713707190980 + 12.5995416408519i,2.97843708026702 + 0.720122382842842i,-4.37137066165710 - 9.61897567995775i,-4.17749358241600 - 7.72904430048784i,3.41786861831513 - 6.22287386215166i,8.78343072695028 - 13.4981403144198i,6.37841660645265 - 15.6996834435559i,1.02819120857150 - 2.32717629763020i,-2.00000000000000 + 11.0000000000000i,-4.12059345808667 + 6.06953397999888i,-6.42060753563634 - 7.24390286745456i,-4.52052846866466 - 6.83734814387697i,2.73925450288316 + 5.62528745693589i,6.45839387077677 + 9.11435036996946i,-1.57902318119488 - 1.26976930193428i,-14.6302979929863 - 7.93458174469899i,-16.7086045308305 - 1.16667057714390i,-3.46956452295331 + 6.77300469630859i,10.2315992812773 + 4.21454373331005i,8.27383674662998 - 2.26258551627680i,-5.57520625654750 - 2.17836472770627i,-11.6528923099985 + 1.99837010250523i,0.0422170979780556 + 3.33093013329064i,16.0288305383376 + 3.69221326624415i,16.7038709577704 + 6.70019706175354i,1.90931854883839 + 7.16806558871353i,-10.3503324930229 + 0.626759086122149i,-8.66693886306923 - 4.26278897878464i,0.0293678068656957 + 2.58777669605492i,5.51944537650944 + 13.4524244304732i,8.46027054648140 + 11.3217976334419i,12.5137261618422 - 3.46149193564916i,13.2103939039742 - 11.6789810180082i,5.73015607844254 - 3.32405086258632i,-2.95738811478765 + 8.70789254650120i,-1.87035442580149 + 9.92603841141813i,6.93034203622490 + 4.81962020812040i,10.1256981242995 + 5.20398452439286i,1.58210390294372 + 9.33467299307272i,-10.2307533099567 + 6.83247109193132i,-14.0208152801713 - 1.87867965644036i,-7.49576603562223 - 5.64418151002769i,3.42268468828998 - 0.261110273202585i,11.0932732949255 + 6.63274877324093i,11.1045090968350 + 8.90701378756027i,5.38652753012552 + 9.20722041175520i,0.277407654357958 + 10.7266201200608i,-1.67417740112608 + 10.9971007702754i,-4.97068372338835 + 7.58739063119219i,-11.8264874631753 + 3.52848409188326i,-14.8604447905440 + 3.37891413721531i,-7.35839238053947 + 7.38860391792920i,3.34645217131677 + 11.2354936386723i,3.85335105960026 + 9.59486082486525i,-5.16849249519295 + 1.18300523172052i,-8.78438319030685 - 7.56048230085050i,0.483919279107635 - 7.54067935828086i,12.3465603856973 + 0.910609101573737i,14.6682543051553 + 6.90068215748101i,9.37327385669847 + 4.96164182653211i,5.67508762144228 + 3.80034449117413i,5.83060546482238 + 10.4835892539666i,6.18203112902129 + 15.6588783874250i,6.58071900759501 + 8.41737673330408i,9.28911331504240 - 2.43232788539885i,11.2481908521660 - 0.422679520970770i,6.52495614527124 + 10.3010459544139i,-3.63038960927716 + 10.5383848951354i,-10.7022341669195 - 1.07728023434817i,-10.0246157886334 - 4.97230148729020i,-5.77081105246754 + 5.25399566073764i,-3.36275368727747 + 10.7751630996225i,-3.00000000000000 + 0.00000000000000i,-3.36275368727747 - 10.7751630996225i,-5.77081105246754 - 5.25399566073764i,-10.0246157886335 + 4.97230148729020i,-10.7022341669195 + 1.07728023434817i,-3.63038960927716 - 10.5383848951354i,6.52495614527124 - 10.3010459544139i,11.2481908521660 + 0.422679520970771i,9.28911331504240 + 2.43232788539885i,6.58071900759501 - 8.41737673330408i,6.18203112902129 - 15.6588783874250i,5.83060546482238 - 10.4835892539666i,5.67508762144228 - 3.80034449117413i,9.37327385669847 - 4.96164182653211i,14.6682543051553 - 6.90068215748101i,12.3465603856973 - 0.910609101573736i,0.483919279107635 + 7.54067935828086i,-8.78438319030686 + 7.56048230085050i,-5.16849249519295 - 1.18300523172052i,3.85335105960026 - 9.59486082486525i,3.34645217131677 - 11.2354936386723i,-7.35839238053946 - 7.38860391792920i,-14.8604447905440 - 3.37891413721531i,-11.8264874631753 - 3.52848409188326i,-4.97068372338835 - 7.58739063119219i,-1.67417740112608 - 10.9971007702754i,0.277407654357955 - 10.7266201200608i,5.38652753012552 - 9.20722041175520i,11.1045090968350 - 8.90701378756027i,11.0932732949255 - 6.63274877324093i,3.42268468828997 + 0.261110273202586i,-7.49576603562223 + 5.64418151002769i,-14.0208152801713 + 1.87867965644036i,-10.2307533099567 - 6.83247109193132i,1.58210390294372 - 9.33467299307272i,10.1256981242995 - 5.20398452439286i,6.93034203622490 - 4.81962020812040i,-1.87035442580149 - 9.92603841141813i,-2.95738811478764 - 8.70789254650120i,5.73015607844255 + 3.32405086258632i,13.2103939039742 + 11.6789810180083i,12.5137261618422 + 3.46149193564916i,8.46027054648140 - 11.3217976334419i,5.51944537650944 - 13.4524244304732i,0.0293678068656944 - 2.58777669605492i,-8.66693886306923 + 4.26278897878464i,-10.3503324930229 - 0.626759086122151i,1.90931854883839 - 7.16806558871353i,16.7038709577704 - 6.70019706175354i,16.0288305383376 - 3.69221326624415i,0.0422170979780558 - 3.33093013329064i,-11.6528923099985 - 1.99837010250522i,-5.57520625654750 + 2.17836472770626i,8.27383674662998 + 2.26258551627681i,10.2315992812773 - 4.21454373331005i,-3.46956452295331 - 6.77300469630859i,-16.7086045308305 + 1.16667057714390i,-14.6302979929863 + 7.93458174469899i,-1.57902318119488 + 1.26976930193428i,6.45839387077677 - 9.11435036996946i,2.73925450288316 - 5.62528745693589i,-4.52052846866466 + 6.83734814387698i,-6.42060753563634 + 7.24390286745456i,-4.12059345808667 - 6.06953397999889i,-2.00000000000000 - 11.0000000000000i,1.02819120857150 + 2.32717629763020i,6.37841660645265 + 15.6996834435559i,8.78343072695028 + 13.4981403144198i,3.41786861831513 + 6.22287386215166i,-4.17749358241600 + 7.72904430048783i,-4.37137066165710 + 9.61897567995776i,2.97843708026702 - 0.720122382842841i,9.64713707190980 - 12.5995416408519i,11.3630467324334 - 7.17670426717723i,10.5296077956155 + 9.68418589800755i,8.81437740483340 + 14.7110399644103i,5.81023638794935 + 2.70423896649077i,3.46726259818561 - 9.04374116080166i,3.40903546940824 - 10.4114875915787i,1.77094684749694 - 9.57229838736069i,-4.70387095777035 - 12.3570513112459i,-10.0750213318243 - 11.7439795224398i,-6.39244895254433 - 3.42138632637433i,3.03375951235730 + 5.60264217382097i,7.88931981850662 + 9.70601515312215i,5.79456246255546 + 11.1712399111790i,1.96544903655094 + 9.70554656403885i,-2.68228020074089 + 0.567426490968557i,-9.81935764388389 - 11.9642962821461i,-12.9731767516584 - 14.4586368583378i,-4.32201568471860 - 4.21274748214057i,8.52644400608524 + 4.45983319639078i,9.56429174099717 + 0.869538913907148i,-0.557022447888014 - 7.75050317364070i,-4.40836018795676 - 10.0585194310449i,4.00618134831581 - 7.01873387741433i,10.0208152801713 - 6.12132034355964i,3.87634321645805 - 8.77827085441109i,-3.56489732419499 - 11.5439453013850i,-1.20928304016722 - 12.4614641399692i,3.18292964612356 - 9.99992718571331i,-2.08390041920985 - 2.60137557170922i,-12.0114172392056 + 6.19212915519980i,-13.7660309751284 + 9.50858263285062i,-6.42035253670194 + 7.39674906662299i,1.63087600835391 + 7.02992849642516i,7.05871372382691 + 9.86920204386705i,10.9520971263999 + 8.34752450586883i,10.8577951211524 - 0.818766871653735i,5.62653237336524 - 9.77887975273393i,2.28785994476883 - 10.6799856211212i,6.52218174593093 - 5.04872576829450i,11.5160807208924 + 1.88382510878848i,7.67248108945205 + 7.88063477449775i,-1.15066377319587 + 11.5351231720892i,-2.89176293794594 + 11.6402382020580i,3.96694732931443 + 10.8484646654518i,8.27981769852599 + 11.8699706770650i,2.65148921477748 + 10.4334693288181i,-7.12172019108237 + 2.32937769755896i,-10.2276458561217 - 4.70646733462740i,-2.77470325590140 - 0.491547349461057i,8.84755214289734 + 7.81719373786391i,13.4759847683106 + 3.75347936795003i,5.76303852554061 - 9.85663096674487i,-6.77026573240681 - 12.0421248902170i,-11.1913751987546 + 1.71187471778555i,-5.47331107831098 + 9.84411089597470i};

  std::array <std::complex<float>,ssb_nfft> pss_seq_ref_t_2 = {-1.00000000000000 + 0.00000000000000i,2.54960973976398 + 11.4730063320961i,4.72373236322565 + 10.4027023435530i,-3.14136978392857 + 3.57859649010713i,-11.1684032876186 + 1.33701567162675i,-5.94898264450205 - 0.931124047163525i,7.05544568713142 - 8.08716376629921i,12.9275409755594 - 8.97875477035739i,10.1588357451667 + 4.38367160256721i,8.10842151311103 + 16.1649635104753i,8.90392747954262 + 8.31056448634214i,7.02595340742398 - 8.91678222057911i,1.58227428429436 - 11.9868779129762i,-3.72075457261583 - 0.281915256263582i,-7.67609915393493 + 7.76774574626659i,-8.78773322790789 + 7.53398420537136i,-3.06773919172440 + 10.3481817416554i,6.11198546977574 + 16.1429845793535i,6.50454841914189 + 11.6505668480455i,-4.02696141537541 - 2.25214948239551i,-9.63638224625775 - 7.45983514122218i,-0.692713345859703 + 1.46959434349511i,8.26810821900154 + 7.93128565105486i,1.72648450190627 + 1.83957185708847i,-9.69385265560847 - 4.29192575853501i,-6.87789553202789 + 1.20014356279195i,4.43630904695984 + 9.21972969647867i,3.50321134779060 + 7.56705129035778i,-8.98286919296038 + 2.35467753412605i,-11.8539175516109 + 5.19617627334978i,0.0271494071145062 + 10.8494270720297i,7.19968660440144 + 5.84732994766891i,-1.87867965644036 - 7.29289321881345i,-13.6302977422913 - 12.7384604246100i,-12.7161244769454 - 6.47136093372760i,-2.70588776411129 - 1.71811201289854i,5.74629703120170 - 6.55217470189751i,10.4088378574109 - 11.4284687073055i,11.5410229323444 - 6.56564861291360i,5.32857901282857 + 0.524836747837613i,-6.39012993603695 - 3.03715473112550i,-12.1744655802319 - 13.2087776455132i,-6.97595370819257 - 13.6054649269831i,-1.61939072152319 - 1.44313967976253i,-6.36243621502862 + 6.76118552819100i,-14.3697357746633 + 0.707534105585804i,-12.4595053234649 - 7.17385692389292i,-1.30763093187353 - 2.09340780738627i,6.39522689797245 + 8.13239225283570i,4.40686213485918 + 5.47276094635208i,-0.364862202354479 - 7.75695474187196i,0.892631865159910 - 11.4346352882952i,7.89907043230522 - 0.571737770090732i,12.6622871764907 + 5.94025644374563i,8.80027260803962 - 3.96488394312409i,-0.983981015488508 - 16.1650466888221i,-6.79725960424079 - 13.9595072826400i,-2.76651882058866 - 4.50662404656348i,4.99261739574215 - 5.08077126405615i,5.94824992842662 - 14.2237850138951i,-0.638104167377387 - 15.2486045864500i,-5.75676231867406 - 3.30138154187188i,-4.90158126083019 + 8.58669086477147i,-3.91770987274177 + 9.96355352805103i,-8.00000000000000 + 5.00000000000000i,-13.0521801963305 + 1.96092434001075i,-13.0418259934891 + 1.66691343973989i,-9.42789508681680 - 0.0904900000621953i,-7.14315636131988 - 5.45627741394205i,-6.00137601341140 - 12.0797571927333i,-2.68745472530609 - 14.1287531258953i,1.66851536445376 - 6.90048748864819i,2.23465046889669 + 5.91681035168886i,-2.38200835244109 + 12.9611891525153i,-8.54880340817190 + 7.98046134994937i,-12.1810841371555 - 2.18360382761212i,-11.0923999721474 - 7.64307606785882i,-4.73851107601854 - 8.12107758357271i,3.55631044559772 - 8.79307679385676i,5.86004512830545 - 9.47470045349393i,-2.39522689797245 - 7.18131624614906i,-13.4497086445778 - 4.87588033080686i,-13.3322234954860 - 7.26312829093494i,0.122858964323553 - 10.6651935233281i,11.8696613430694 - 7.52772959519849i,7.88953885626234 + 0.500805344625617i,-5.88038112680220 + 4.21601014956930i,-10.7245341298128 + 1.14579377126963i,0.500235352370041 - 1.61334081580765i,14.9439676095688 + 0.538900372428675i,17.1529627410098 + 3.86075727683081i,6.66343171406079 + 4.02520357903136i,-5.77032406848512 + 2.02786008527483i,-12.4243987095002 + 0.649798226214447i,-12.9759758153305 + 1.18143851039837i,-9.80547144944601 + 4.31683675802872i,-6.12132034355964 + 8.70710678118655i,-5.95838908891143 + 9.45989159198780i,-9.61257509619782 + 4.47303166175101i,-11.0369115502043 + 0.518684883886059i,-5.25892175915828 + 4.87096150953090i,4.09736409152316 + 12.2277996982596i,10.0411451905391 + 10.0177324962395i,11.3210311279975 - 2.61619198043760i,9.92689298978300 - 11.8386745916943i,4.32861899115268 - 8.29238587298316i,-5.59187199696030 + 0.613648806519471i,-10.9575683390018 + 2.75267363759734i,-3.15252117336995 - 2.57792483718756i,10.9798262467746 - 7.00448755558835i,16.0302115251411 - 5.63201388823986i,10.2747190964022 - 0.760457047449840i,7.06773919172440 + 3.03447324267061i,11.6529864266411 + 2.15811818859431i,12.1421451432535 - 4.33875075712016i,0.516562956442499 - 11.6514817926607i,-11.7935579538805 - 11.2010992823050i,-10.4606098679957 - 0.812384493909128i,0.210908808992953 + 9.89887037850835i,5.00311780023192 + 9.68322505270019i,0.0606276396697387 - 0.710573511581063i,-5.50118126357124 - 10.3244625325208i,-6.46342114793136 - 11.9814761979414i,-7.15455143186521 - 8.69089637612308i,-10.0982266932668 - 6.24811646661760i,-9.74620630319505 - 5.55942739350062i,-1.15815848138022 - 4.42333501804178i,11.1623683472224 - 2.27979390781230i,17.0000000000000 + 0.00000000000000i,11.1623683472224 + 2.27979390781230i,-1.15815848138022 + 4.42333501804178i,-9.74620630319505 + 5.55942739350062i,-10.0982266932668 + 6.24811646661760i,-7.15455143186521 + 8.69089637612308i,-6.46342114793136 + 11.9814761979414i,-5.50118126357124 + 10.3244625325208i,0.0606276396697405 + 0.710573511581062i,5.00311780023192 - 9.68322505270019i,0.210908808992951 - 9.89887037850834i,-10.4606098679957 + 0.812384493909126i,-11.7935579538805 + 11.2010992823050i,0.516562956442499 + 11.6514817926607i,12.1421451432535 + 4.33875075712016i,11.6529864266411 - 2.15811818859431i,7.06773919172440 - 3.03447324267061i,10.2747190964022 + 0.760457047449843i,16.0302115251411 + 5.63201388823986i,10.9798262467746 + 7.00448755558834i,-3.15252117336995 + 2.57792483718756i,-10.9575683390018 - 2.75267363759734i,-5.59187199696030 - 0.613648806519471i,4.32861899115269 + 8.29238587298316i,9.92689298978300 + 11.8386745916943i,11.3210311279975 + 2.61619198043760i,10.0411451905391 - 10.0177324962395i,4.09736409152316 - 12.2277996982596i,-5.25892175915828 - 4.87096150953090i,-11.0369115502043 - 0.518684883886057i,-9.61257509619782 - 4.47303166175101i,-5.95838908891142 - 9.45989159198780i,-6.12132034355964 - 8.70710678118655i,-9.80547144944601 - 4.31683675802872i,-12.9759758153305 - 1.18143851039837i,-12.4243987095002 - 0.649798226214447i,-5.77032406848513 - 2.02786008527483i,6.66343171406079 - 4.02520357903136i,17.1529627410098 - 3.86075727683082i,14.9439676095688 - 0.538900372428675i,0.500235352370043 + 1.61334081580765i,-10.7245341298128 - 1.14579377126963i,-5.88038112680220 - 4.21601014956930i,7.88953885626234 - 0.500805344625618i,11.8696613430694 + 7.52772959519849i,0.122858964323554 + 10.6651935233281i,-13.3322234954860 + 7.26312829093494i,-13.4497086445778 + 4.87588033080686i,-2.39522689797245 + 7.18131624614906i,5.86004512830545 + 9.47470045349393i,3.55631044559772 + 8.79307679385676i,-4.73851107601854 + 8.12107758357271i,-11.0923999721474 + 7.64307606785881i,-12.1810841371555 + 2.18360382761212i,-8.54880340817189 - 7.98046134994937i,-2.38200835244109 - 12.9611891525153i,2.23465046889669 - 5.91681035168886i,1.66851536445376 + 6.90048748864818i,-2.68745472530609 + 14.1287531258953i,-6.00137601341140 + 12.0797571927333i,-7.14315636131988 + 5.45627741394205i,-9.42789508681681 + 0.0904900000621970i,-13.0418259934891 - 1.66691343973989i,-13.0521801963305 - 1.96092434001074i,-8.00000000000000 - 5.00000000000000i,-3.91770987274177 - 9.96355352805103i,-4.90158126083019 - 8.58669086477147i,-5.75676231867406 + 3.30138154187188i,-0.638104167377387 + 15.2486045864500i,5.94824992842662 + 14.2237850138951i,4.99261739574216 + 5.08077126405615i,-2.76651882058866 + 4.50662404656348i,-6.79725960424079 + 13.9595072826400i,-0.983981015488508 + 16.1650466888221i,8.80027260803963 + 3.96488394312409i,12.6622871764907 - 5.94025644374562i,7.89907043230522 + 0.571737770090731i,0.892631865159909 + 11.4346352882952i,-0.364862202354477 + 7.75695474187196i,4.40686213485918 - 5.47276094635207i,6.39522689797245 - 8.13239225283570i,-1.30763093187353 + 2.09340780738627i,-12.4595053234649 + 7.17385692389292i,-14.3697357746633 - 0.707534105585804i,-6.36243621502862 - 6.76118552819100i,-1.61939072152319 + 1.44313967976253i,-6.97595370819257 + 13.6054649269831i,-12.1744655802319 + 13.2087776455132i,-6.39012993603695 + 3.03715473112550i,5.32857901282857 - 0.524836747837614i,11.5410229323444 + 6.56564861291360i,10.4088378574109 + 11.4284687073055i,5.74629703120170 + 6.55217470189751i,-2.70588776411129 + 1.71811201289854i,-12.7161244769454 + 6.47136093372760i,-13.6302977422913 + 12.7384604246100i,-1.87867965644036 + 7.29289321881345i,7.19968660440144 - 5.84732994766892i,0.0271494071145089 - 10.8494270720297i,-11.8539175516109 - 5.19617627334978i,-8.98286919296038 - 2.35467753412605i,3.50321134779060 - 7.56705129035778i,4.43630904695984 - 9.21972969647867i,-6.87789553202789 - 1.20014356279195i,-9.69385265560847 + 4.29192575853501i,1.72648450190627 - 1.83957185708847i,8.26810821900154 - 7.93128565105486i,-0.692713345859703 - 1.46959434349511i,-9.63638224625776 + 7.45983514122218i,-4.02696141537541 + 2.25214948239551i,6.50454841914189 - 11.6505668480455i,6.11198546977574 - 16.1429845793535i,-3.06773919172440 - 10.3481817416554i,-8.78773322790789 - 7.53398420537136i,-7.67609915393493 - 7.76774574626658i,-3.72075457261583 + 0.281915256263580i,1.58227428429436 + 11.9868779129762i,7.02595340742398 + 8.91678222057911i,8.90392747954262 - 8.31056448634214i,8.10842151311103 - 16.1649635104753i,10.1588357451667 - 4.38367160256721i,12.9275409755594 + 8.97875477035739i,7.05544568713142 + 8.08716376629921i,-5.94898264450205 + 0.931124047163527i,-11.1684032876186 - 1.33701567162675i,-3.14136978392857 - 3.57859649010713i,4.72373236322565 - 10.4027023435530i,2.54960973976398 - 11.4730063320961i};


  for (int i = 0; i < pss_f_matrix.at(0).size(); ++i) {
    EXPECT_FLOAT_EQ((pss_f_matrix.at(0).at(i)).real(), (pss_seq_ref_f_0.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((pss_f_matrix.at(0).at(i)).imag(), (pss_seq_ref_f_0.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < pss_f_matrix.at(1).size(); ++i) {
    EXPECT_FLOAT_EQ((pss_f_matrix.at(1).at(i)).real(), (pss_seq_ref_f_1.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((pss_f_matrix.at(1).at(i)).imag(), (pss_seq_ref_f_1.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < pss_f_matrix.at(2).size(); ++i) {
    EXPECT_FLOAT_EQ((pss_f_matrix.at(2).at(i)).real(), (pss_seq_ref_f_2.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((pss_f_matrix.at(2).at(i)).imag(), (pss_seq_ref_f_2.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < pss_t_matrix.at(0).size(); ++i) {
    EXPECT_NEAR((pss_t_matrix.at(0).at(i)).real(), (pss_seq_ref_t_0.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((pss_t_matrix.at(0).at(i)).imag(), (pss_seq_ref_t_0.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < pss_t_matrix.at(1).size(); ++i) {
    EXPECT_NEAR((pss_t_matrix.at(1).at(i)).real(), (pss_seq_ref_t_1.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((pss_t_matrix.at(1).at(i)).imag(), (pss_seq_ref_t_1.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

  for (int i = 0; i < pss_t_matrix.at(2).size(); ++i) {
    EXPECT_NEAR((pss_t_matrix.at(2).at(i)).real(), (pss_seq_ref_t_2.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR((pss_t_matrix.at(2).at(i)).imag(), (pss_seq_ref_t_2.at(i)).imag(),0.00001) << "Vectors x and y differ at imaginary index " << i;
  }

}

TEST_F(pss_test, test_IFFT_shift) {

  pss pss1;
  
  std::array <std::complex<float>,pss::pss_length>  pss_seq_f_0 = pss1.generate_pss_seq(0);

    //Padding with 0's to put the PSS in the correct subcarriers
  std::array <std::complex<float>,ssb_nfft> pss_seq_f_0_padded = {};
  for (int i= 0 ; i< pss::pss_length ; i++){
    pss_seq_f_0_padded.at(i+64) = pss_seq_f_0.at(i);
  }  

  std::array <std::complex<float>,ssb_nfft>  pss_seq_f_shifted_0 = {-1,1,1,-1,-1,1,-1,1,1,-1,-1,-1,-1,1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,-1,-1,-1,1,1,1,-1,-1,-1,1,-1,-1,1,1,1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,-1,1,-1,1,1,1,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,-1,1,-1,-1,-1,-1,1,1,-1,-1,-1,1,1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,-1,1,1,1,-1,-1,1,1,-1,1,1,1,-1,1,1,1,1,1,1,-1,1,1}; 

    // Perform IFFT shift
  std::rotate(pss_seq_f_0_padded.begin(), pss_seq_f_0_padded.begin() + 128, pss_seq_f_0_padded.end());
  
  for (int i = 0; i < pss_seq_f_0.size(); ++i) {
    EXPECT_FLOAT_EQ((pss_seq_f_0_padded.at(i)).real(), (pss_seq_f_shifted_0.at(i)).real()) << "Vectors x and y differ at real index " << i;
    EXPECT_FLOAT_EQ((pss_seq_f_0_padded.at(i)).imag(), (pss_seq_f_shifted_0.at(i)).imag()) << "Vectors x and y differ at imaginary index " << i;
  }


}



TEST_F(pss_test, test_FFT_precision) {

  pss pss1;
  
  std::array <std::complex<float>,pss::pss_length>  pss_seq_f = pss1.generate_pss_seq(0);
  
  std::array <std::complex<float>,pss::pss_length>  pss_seq_f_ref = pss1.generate_pss_seq(0);

  std::array <std::complex<float>,ssb_nfft>  pss_seq_t = {};

  //Padding with 0's to put the PSS in the correct subcarriers
  std::array <std::complex<float>,ssb_nfft> pss_seq_f_padded = {};
  for (int i= 0 ; i< pss::pss_length ; i++){
    pss_seq_f_padded.at(i+64) = pss_seq_f.at(i);
  }  

  //Padding with 0's to put the PSS in the correct subcarriers
  std::array <std::complex<float>,ssb_nfft> pss_seq_f_ref_padded = {};
  for (int i= 0 ; i< pss::pss_length ; i++){
    pss_seq_f_ref_padded.at(i+64) = pss_seq_f_ref.at(i);
  }  


    // Perform ifft shift
  std::rotate(pss_seq_f_padded.begin(), pss_seq_f_padded.begin() + 128, pss_seq_f_padded.end());
  
  auto p_time = reinterpret_cast<liquid_float_complex*>(pss_seq_t.data());
  auto p_freq = reinterpret_cast<liquid_float_complex*>(pss_seq_f_padded.data());
  
  // create IFFT plan
  int flags = 0;
  fftplan q = fft_create_plan(pss_seq_f_padded.size(), p_freq, p_time, LIQUID_FFT_BACKWARD, flags);

    // execute IFFT 
    fft_execute(q);

    // destroy FFT plan
    fft_destroy_plan(q);

  // create FFT plan

  q = fft_create_plan(pss_seq_f_padded.size(), p_time, p_freq, LIQUID_FFT_FORWARD, flags);

    // execute IFFT 
    fft_execute(q);

    // destroy FFT plan
    fft_destroy_plan(q);

    // Perform fft shift
  std::rotate(pss_seq_f_padded.begin(), pss_seq_f_padded.begin() + 128, pss_seq_f_padded.end());

  
  for (int i = 0; i < pss_seq_f_padded.size(); ++i) {
    EXPECT_NEAR(pss_seq_f_padded.at(i).real()/256, (pss_seq_f_ref_padded.at(i)).real(),0.00001) << "Vectors x and y differ at real index " << i;
    EXPECT_NEAR(pss_seq_f_padded.at(i).imag()/256, (pss_seq_f_ref_padded.at(i)).imag(),0.00001) << "Vectors x and y differ at real index " << i;
  }



}

